package com.test.util;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public  class  JDBCUtil {
    static String  url="jdbc:mysql://localhost:3306/test";
    public static String username="root";
    public static String password="12345678";
    static {
        try {
            Class.forName("com.mysql.jdbc.Driver");
        } catch (ClassNotFoundException e) {
            throw new RuntimeException(e);
        }
    }

    public static  Connection getConnection() {
    Connection connection;
            try {
               connection= DriverManager.getConnection(url,username,password);
            }catch (SQLException e){
                throw new RuntimeException(e);
            }
        return  connection;
    }
}
